package com.filepd.entity.Enum;

/**
 * 网络环境枚举
 */
public enum network implements netWorkEnum{

    /**
     * 宿舍虚拟机
     */
    VM_MY_NETWORK(0, "http://127.0.0.1"),

    /**
     * 机房虚拟机
     */
    VM_SCHOOL_NETWORK(1, "http://127.0.0.1"),

    /**
     * 宿舍本地
     */
    LOCAL_NETWORK(2,"http://127.0.0.1"),

    /**
     * 远程
     */
    SERVEL_NETWORK(4, "http://127.0.0.1");


    /** 值 */
    private final Integer code;

    /** 名称 */
    private final String netWork;

    network(int code, String netWork) {
        this.code = code;
        this.netWork = netWork;
    }

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getNetWork() {
        return netWork;
    }

    public static network getByCode(Integer code) {
        if (null == code) {
            return null;
        }
        for (network status : network.values()) {
            if (status.getCode().intValue() == code.intValue()) {
                return status;
            }
        }
        return null;
    }

    public static network getByName(String netWork) {
        for (network status : network.values()) {
            if (status.getNetWork().equals(netWork)) {
                return status;
            }
        }
        return null;
    }

}
